package com.clp.util;

import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.jar.Attributes;
import java.util.jar.Manifest;

public class ManifestUtil {
    private ManifestUtil() {
    }

//    private static final Map<String, Manifest> CACHE_MAP = new HashMap<>(10);
//
//    public static String getImplementationVersion(Path manifestAbsPath) {
//        AssertUtil.notNull(manifestAbsPath, "manifestAbsPath");
//        String path = manifestAbsPath.toString();
//        synchronized (ManifestUtil.class) {
//                Manifest manifest = CACHE_MAP.get();
//                if (manifest != null) {
//                    return getImplementationVersion(manifest);
//                }
//
//            try(InputStream inputStream = Files.newInputStream(new File(path).toPath())) {
//                manifest = new Manifest(inputStream);
//                CACHE_MAP.put(path, manifest);
//                return getImplementationVersion(manifest);
//            } catch (Exception e) {
//                throw new IllegalArgumentException(path, e);
//            }
//        }
//    }
//
//    private static String getImplementationVersion(Manifest manifest) {
//        return manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);
//    }
//
//    public static Path findManifestPath(Path classpath) {
//        classpath.getParent()
//    }
}
